package com.example.directoryoperations.unit15;
import java.io.File;
/**
 * @author ASUS
 */
public class Main {
    public static void main(String[] args) {
        System.out.println("遍历目录");
        File dir = new File("/www/java");
        visitAllFiles(dir);
    }

    public static void visitAllFiles(File dir) {
        System.out.println(dir);
        if (dir.isDirectory()){
            String[] children = dir.list();
            for (int i = 0; i < children.length; i++) {
                visitAllFiles(new File(dir, children[i]));
            }
        }
    }
}
